package com.zhangyj.db;

import java.sql.Array;
import java.sql.Blob;
import java.sql.CallableStatement;
import java.sql.Clob;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.NClob;
import java.sql.PreparedStatement;
import java.sql.SQLClientInfoException;
import java.sql.SQLException;
import java.sql.SQLWarning;
import java.sql.SQLXML;
import java.sql.Savepoint;
import java.sql.Statement;
import java.sql.Struct;
import java.util.Map;
import java.util.Properties;

public class DBConnection implements Connection {
	private Connection conn = null;

	DBConnection(Connection conn) {
		this.conn = conn;
	}

	
	public void clearWarnings() throws SQLException {
		conn.clearWarnings();

	}

	
	public void close() throws SQLException {
		boolean autoCommit = conn.getAutoCommit();
		conn.close();
		if (autoCommit == false) {
			throw new SQLException("事物没有提交");
		}
	}

	
	public void commit() throws SQLException {
		this.conn.commit();

	}

	
	public Array createArrayOf(String typeName, Object[] elements) throws SQLException {
		return this.conn.createArrayOf(typeName, elements);
	}

	
	public Blob createBlob() throws SQLException {
		return this.conn.createBlob();
	}

	
	public Clob createClob() throws SQLException {
		return this.conn.createClob();
	}

	
	public NClob createNClob() throws SQLException {
		return this.conn.createNClob();
	}

	
	public SQLXML createSQLXML() throws SQLException {
		return this.conn.createSQLXML();
	}

	
	public Statement createStatement() throws SQLException {
		return this.conn.createStatement();
	}

	
	public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
		return this.conn.createStatement(resultSetType, resultSetConcurrency, resultSetHoldability);
	}

	
	public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException {
		return this.conn.createStatement(resultSetType, resultSetConcurrency);
	}

	
	public Struct createStruct(String typeName, Object[] attributes) throws SQLException {
		return this.conn.createStruct(typeName, attributes);
	}

	
	public boolean getAutoCommit() throws SQLException {
		return this.conn.getAutoCommit();
	}

	
	public String getCatalog() throws SQLException {
		return this.conn.getCatalog();
	}

	
	public Properties getClientInfo() throws SQLException {
		return this.conn.getClientInfo();
	}

	
	public String getClientInfo(String name) throws SQLException {
		return this.conn.getClientInfo(name);
	}

	
	public int getHoldability() throws SQLException {
		return this.conn.getHoldability();
	}

	
	public DatabaseMetaData getMetaData() throws SQLException {
		return this.conn.getMetaData();
	}

	
	public int getTransactionIsolation() throws SQLException {
		return this.conn.getTransactionIsolation();
	}

	
	public Map<String, Class<?>> getTypeMap() throws SQLException {
		return this.conn.getTypeMap();
	}

	
	public SQLWarning getWarnings() throws SQLException {
		return this.conn.getWarnings();
	}

	
	public boolean isClosed() throws SQLException {
		return this.conn.isClosed();
	}

	
	public boolean isReadOnly() throws SQLException {
		return this.conn.isReadOnly();
	}

	
	public boolean isValid(int timeout) throws SQLException {
		return this.conn.isValid(timeout);
	}

	
	public String nativeSQL(String sql) throws SQLException {
		return this.conn.nativeSQL(sql);
	}

	
	public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
			throws SQLException {
		return this.conn.prepareCall(sql, resultSetType, resultSetConcurrency, resultSetHoldability);
	}

	
	public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
		return this.conn.prepareCall(sql, resultSetType, resultSetConcurrency);
	}

	
	public CallableStatement prepareCall(String sql) throws SQLException {
		return this.conn.prepareCall(sql);
	}

	
	public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
			throws SQLException {
		return this.conn.prepareStatement(sql, resultSetType, resultSetConcurrency, resultSetHoldability);

	}

	
	public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
		return this.conn.prepareStatement(sql, resultSetType, resultSetConcurrency);
	}

	
	public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException {
		return this.conn.prepareStatement(sql, autoGeneratedKeys);
	}

	
	public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException {
		return this.conn.prepareStatement(sql, columnIndexes);
	}

	
	public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException {
		return this.conn.prepareStatement(sql, columnNames);
	}

	
	public PreparedStatement prepareStatement(String sql) throws SQLException {
		return this.conn.prepareStatement(sql);
	}

	
	public void releaseSavepoint(Savepoint savepoint) throws SQLException {
		this.conn.releaseSavepoint(savepoint);
	}

	
	public void rollback() throws SQLException {
		this.conn.rollback();
	}

	
	public void rollback(Savepoint savepoint) throws SQLException {
		this.conn.rollback(savepoint);
	}

	
	public void setAutoCommit(boolean autoCommit) throws SQLException {
		this.conn.setAutoCommit(autoCommit);
	}

	
	public void setCatalog(String catalog) throws SQLException {
		this.conn.setCatalog(catalog);
	}

	
	public void setClientInfo(Properties properties) throws SQLClientInfoException {
		this.conn.setClientInfo(properties);
	}

	
	public void setClientInfo(String name, String value) throws SQLClientInfoException {
		this.conn.setClientInfo(name, value);
	}

	
	public void setHoldability(int holdability) throws SQLException {
		this.conn.setHoldability(holdability);
	}

	
	public void setReadOnly(boolean readOnly) throws SQLException {
		this.conn.setReadOnly(readOnly);
	}

	
	public Savepoint setSavepoint() throws SQLException {
		return this.conn.setSavepoint();
	}

	
	public Savepoint setSavepoint(String name) throws SQLException {
		return this.conn.setSavepoint(name);
	}

	
	public void setTransactionIsolation(int level) throws SQLException {
		this.conn.setTransactionIsolation(level);
	}

	
	public void setTypeMap(Map<String, Class<?>> map) throws SQLException {
		this.conn.setTypeMap(map);
	}

	
	public boolean isWrapperFor(Class<?> iface) throws SQLException {
		return this.conn.isWrapperFor(iface);
	}

	
	public <T> T unwrap(Class<T> iface) throws SQLException {
		return this.conn.unwrap(iface);
	}

}
